package com.example.administrator.myapplication.muscle;


import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.NumberPicker;

/**
 * 这个是一个自定义的Numberpicker 类
 */

public class Muscle_numberpicker extends NumberPicker{


    public Muscle_numberpicker(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public Muscle_numberpicker(Context context) {
        super(context);
    }

    public Muscle_numberpicker(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void addView(View child, ViewGroup.LayoutParams params) {
        super.addView(child, params);
        updateView(child);

    }

    @Override
    public void addView(View child, int index, ViewGroup.LayoutParams params) {
        super.addView(child, index, params);
        updateView(child);
    }

    @Override
    public void addView(View child) {
        super.addView(child);
        updateView(child);
    }

    public void updateView (View view){
        if(view instanceof EditText){
            ((EditText)view).setTextColor(Color.parseColor("#00ff00"));
            ((EditText)view).setTextSize(20);

        }
    }
}
